home *** CD-ROM | disk | FTP | other *** search
/ Amiga Collections: Taifun / Taifun 054 (1988-05-15)(Ossowski, Stefan)(DE)(PD).zip / Taifun 054 (1988-05-15)(Ossowski, Stefan)(DE)(PD).adf / MRBackup / MRBackup2.0 / MRBackup.h < prev    next >
C/C++ Source or Header  |  1988-04-09  |  5KB  |  175 lines

  1. /* MRBackup - include file for global data and definitions.
  2.  * Filename:    MRBackup.h
  3.  * Date:        08/22/87
  4.  *
  5.  * History:        (most recent change first)
  6.  *
  7.  * 11/19/87 -MRR- V2.0: Changed window version and date.
  8.  */
  9.  
  10. /* Main.c defines MAIN.  It should not defined elsewhere. */
  11.  
  12. #ifdef MAIN
  13. #define EXTERN 
  14. #else
  15. #define EXTERN extern
  16. #endif
  17.  
  18. #include <exec/memory.h>
  19. #include <exec/types.h>
  20. #include <intuition/intuition.h>
  21. #include <libraries/dos.h>
  22. #include <libraries/dosextens.h>
  23. #include <stdio.h>
  24. #include <ctype.h>
  25. #include <setjmp.h>
  26. #include <time.h>
  27. #include <functions.h>
  28.  
  29. #include "gadget.h"
  30. #include "menu.h"
  31. #include "Console.h"
  32.  
  33. /* Constants */
  34.  
  35. #define false    0        /* for short parameter requirements */
  36. #define true    1        /* for short parameter requirements */
  37. #define BUFMAX (32L * 1024L) /* max size for copy/compress buffer */
  38. #define LINES_PER_PAGE  60
  39.  
  40. #define VOLUME_MAX    32    /* max characters in volume name */
  41. #define PATH_MAX    256 /* max characters in pathname (very arbitrary) */
  42.  
  43. /* Define error recovery constants.  Note that these are all powers
  44.  * of 2 to allow creating 'sets' of allowable options during the
  45.  * recovery prompt.
  46.  */
  47.  
  48. #define NERRCODE            5    /* number of error recovery codes */
  49.  
  50. #define ERR_NONE            0    /* what we want ALL the time :-) */
  51. #define ERR_ABORT            1    /* give up the ship */
  52. #define ERR_RETRY_FILE        2    /* let's try that file one more time */
  53. #define ERR_RESTART_VOLUME     4    /* for media errors on output floppy */
  54. #define ERR_IGNORE            8    /* ignore this error and trudge on */
  55.  
  56. /* Macros */
  57.  
  58. /* determine if a menu item is "checked" */
  59.  
  60. #define GadgetString(g) ((struct StringInfo *) g->SpecialInfo)->Buffer
  61. #define IsChecked(item) ((item->Flags & CHECKED) == CHECKED)
  62.  
  63. typedef struct t_pattern {
  64.     struct t_pattern * next_pattern;
  65.     char *pattern;
  66.     } T_PATTERN;
  67.  
  68. /* The following structure is used to link file and directory node
  69.  * information into a doubly-linked list.  This provides a way to
  70.  * defer processing of sub-directory nodes until all files in a
  71.  * current directory are processed.  As nodes are "consumed", they 
  72.  * are returned to free memory.
  73.  */
  74.  
  75. typedef struct t_file {
  76.     struct t_file  *previous,*next;
  77.     char               *filename;
  78.     USHORT            blocks;
  79.     BOOL             is_dir;            /* TRUE => it's a directory */
  80.     } T_FILE;
  81.  
  82. /* The following structure links lists of T_FILE nodes. */
  83.  
  84. typedef struct t_file_list {
  85.     T_FILE *first_file;
  86.     T_FILE *last_file;
  87.     } T_FILE_LIST;
  88.  
  89. /* External and forward function declarations */
  90.  
  91. extern char       *calloc(), *index(), *rindex();
  92. extern long       DiskBlocks();
  93. extern int          errno;
  94. T_FILE               *FindFile();
  95.  
  96. /* External data */
  97.  
  98. extern struct Gadget stopGadget;
  99.  
  100. /* Global data */
  101.  
  102. #ifdef DEBUG
  103. EXTERN ConIOBlocks *debugConsole;
  104. EXTERN struct Window *debugWindow;
  105. EXTERN char debugMsg[512];
  106. #endif
  107.  
  108. EXTERN UBYTE *buffer;                /* file copy/cmprs buffer (AllocMem) */
  109. EXTERN ULONG bufSize;                /* size of buffer allocated */
  110. EXTERN ConIOBlocks *progressConsole;/* for informative messages */
  111. EXTERN struct Window *progressWindow;
  112. EXTERN char conmsg[512];
  113. EXTERN T_FILE *currentDir = NULL;    /* current directory node */
  114.  
  115. EXTERN char    destPath[PATH_MAX+1];
  116. EXTERN char destVol[VOLUME_MAX+1];
  117. EXTERN short diskNumber;            /* backup disk serial number */
  118. EXTERN USHORT errorCount;            /* count of errors on backup/restore */
  119. EXTERN char *errName;               /* file name associated with error */
  120. EXTERN BOOL excludeHasChanged;       /* true when new path specified */
  121. EXTERN T_PATTERN *excludeList, *lastExclude;
  122. EXTERN char excludePath[81];         /* list of file patterns to exclude */
  123. EXTERN struct FileInfoBlock *fibWork;    /* working file info block */
  124. EXTERN struct GfxBase *GfxBase;        /* graphics library handle */
  125. EXTERN struct IntuitionBase *IntuitionBase;
  126.  
  127. EXTERN USHORT level;                /* file nesting level */
  128. EXTERN USHORT lineCount;            /* number of lines in listing */
  129. EXTERN FILE *listing;
  130. EXTERN T_FILE_LIST mainList;
  131. EXTERN struct Screen *mainScreen;
  132. EXTERN struct Window *mainWindow;
  133.  
  134. EXTERN struct DateStamp *now, *since; /* for date comparisons */
  135. EXTERN struct Window *pathWindow;    /* pathname specification window */
  136. EXTERN LONG sizeLeft;                /* floppy blocks remaining */
  137. EXTERN char    srcPath[PATH_MAX];
  138. EXTERN char    srcVol[VOLUME_MAX+1];    /* source volume name */
  139. EXTERN char temp[256];
  140. EXTERN LONG totalSize;                /* capacity of output device */
  141.  
  142. /* The following flags suppress repetition of spoken
  143.  * messages.  After all, let's not over-do it.
  144.  */
  145.  
  146. EXTERN UBYTE atYourService;
  147.  
  148. /* Preset data */
  149.  
  150. #ifdef MAIN
  151.  
  152. char backPath[81] = "DF0:";            /* where backups go and restores
  153.                                        come from. */
  154. char destDrive[5] = "DF0:";
  155. USHORT doBigFiles = 1;                /* Allow big file backups. */
  156. USHORT doCompress = 1;                /* Perform file compression. */
  157. USHORT doFormat = 1;                /* Format output disks */
  158. USHORT doListing = 1;                /* Generate listing. */
  159. USHORT doSpeech = 1;                /* Talk to the user. */
  160.  
  161. char homePath[81] = "DH0:";            /* Backup/Restore from/to here. */
  162. char listPath[81] = "PRT:";            /* Listings go here. */
  163. #else
  164. /* Declare preset external data without the presets. */
  165. extern char backPath[81];
  166. extern char destDrive[5];
  167. extern USHORT doBigFiles;
  168. extern USHORT doCompress;
  169. extern USHORT doFormat;
  170. extern USHORT doListing;
  171. extern USHORT doSpeech;
  172. extern char homePath[81];
  173. extern char listPath[81];
  174. #endif
  175.